﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>找回密码</title>
    <link href="~/common/Threelinkage/layui/css/layui.css" rel="stylesheet" />
    <style>
        .head {
            height: 50px;
            line-height: 50px;
            text-align: center;
            color: white;
            background-color: rgb(70,180,230);
        }
    </style>

</head>
<body>
    <div class="layui-row head">
        <div class="layui-col-lg1">
            <a href="/Login/Index">
                <i class="layui-icon-left layui-icon"></i>
            </a>
        </div>
        <div class="layui-col-lg6 layui-col-lg-offset2">
            <h2>找回密码</h2>
        </div>
    </div>
    <br />
    <div class="layui-row">
        <div class="layui-col-lg4 layui-col-lg-offset4">
            <form class="layui-form" id="form1">
                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱：</label>
                    <div class="layui-input-block">
                        <input type="email" name="Email" lay-verify="required|email" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">验证码：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="Code" required lay-verify="required|number" placeholder="验证码" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <a href="javascript:void();">
                            <img src="/Login/GetValidCode" id="codeImg" style="margin-top:-7px;" alt="点击" />
                        </a>
                    </div>
                </div>
                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid layui-btn-radius" lay-submit lay-filter="formDemo">
                        下一步
                    </button>
                </div>
            </form>
        </div>
    </div>

    <script src="~/common/Threelinkage/layui/layui.js"></script>
    <script type="text/javascript">
        layui.use(['jquery', 'layer', 'form'], function (args) {
            var $ = layui.jquery, layer = layui.layer, form = layui.form;

            $('#codeImg').click(function () {
                $('#codeImg').attr("src", "/Login/GetValidCode?dt=" + new Date());
            });

            form.on('submit(formDemo)', function () {
                var load = layer.load(1, {
                    shade: [0.1, '#fff'] //0.1透明度的白色背景
                });
                var json = $('#form1').serialize();
                $.ajax({
                    url: '/Login/GetBackPwd1', data: json,
                    dataType: "json",
                    type: 'post',
                    success: function (res) {
                        if (res.status == "ok") {
                            location.href = "/Login/GetBackPwd2";
                        }
                        else if (res.status == "redirect") {
                            location.href = res.data;
                        }
                        else if (res.status == "error") {
                            layer.msg(res.errorMsg, { icon: 2, time: 1000 });
                        }
                        else {
                            layer.msg("错误", { icon: 2, time: 1000 });
                        }
                        layer.close(load);
                    },
                    error: function () {
                        layer.msg("网络错误", { icon: 2, time: 1000 });
                        layer.close(load);
                    }
                });
                $('#codeImg').click();
                return false;
            });

        });

    </script>
</body>
</html>
